/**
 * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package de.hsmannheim.pepa.patientenportal.apanwep.model.impl;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.json.JSON;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.ProxyUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.model.CacheModel;
import com.liferay.portal.model.impl.BaseModelImpl;
import com.liferay.portal.service.ServiceContext;

import com.liferay.portlet.expando.model.ExpandoBridge;
import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;

import de.hsmannheim.pepa.patientenportal.apanwep.model.message_objects;
import de.hsmannheim.pepa.patientenportal.apanwep.model.message_objectsModel;
import de.hsmannheim.pepa.patientenportal.apanwep.model.message_objectsSoap;

import java.io.Serializable;

import java.sql.Types;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * The base model implementation for the message_objects service. Represents a row in the &quot;message_objects&quot; database table, with each column mapped to a property of this class.
 *
 * <p>
 * This implementation and its corresponding interface {@link de.hsmannheim.pepa.patientenportal.apanwep.model.message_objectsModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link message_objectsImpl}.
 * </p>
 *
 * @author Cedric Nana
 * @see message_objectsImpl
 * @see de.hsmannheim.pepa.patientenportal.apanwep.model.message_objects
 * @see de.hsmannheim.pepa.patientenportal.apanwep.model.message_objectsModel
 * @generated
 */
@JSON(strict = true)
public class message_objectsModelImpl extends BaseModelImpl<message_objects>
	implements message_objectsModel {
	/*
	 * NOTE FOR DEVELOPERS:
	 *
	 * Never modify or reference this class directly. All methods that expect a message_objects model instance should use the {@link de.hsmannheim.pepa.patientenportal.apanwep.model.message_objects} interface instead.
	 */
	public static final String TABLE_NAME = "message_objects";
	public static final Object[][] TABLE_COLUMNS = {
			{ "ID", Types.BIGINT },
			{ "object_id", Types.BIGINT }
		};
	public static final String TABLE_SQL_CREATE = "create table message_objects (ID LONG not null primary key,object_id LONG)";
	public static final String TABLE_SQL_DROP = "drop table message_objects";
	public static final String ORDER_BY_JPQL = " ORDER BY message_objects.messageobjectsID ASC";
	public static final String ORDER_BY_SQL = " ORDER BY message_objects.ID ASC";
	public static final String DATA_SOURCE = "myDataSource";
	public static final String SESSION_FACTORY = "mySessionFactory";
	public static final String TX_MANAGER = "myTransactionManager";
	public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.entity.cache.enabled.de.hsmannheim.pepa.patientenportal.apanwep.model.message_objects"),
			true);
	public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.finder.cache.enabled.de.hsmannheim.pepa.patientenportal.apanwep.model.message_objects"),
			true);
	public static final boolean COLUMN_BITMASK_ENABLED = false;

	/**
	 * Converts the soap model instance into a normal model instance.
	 *
	 * @param soapModel the soap model instance to convert
	 * @return the normal model instance
	 */
	public static message_objects toModel(message_objectsSoap soapModel) {
		if (soapModel == null) {
			return null;
		}

		message_objects model = new message_objectsImpl();

		model.setMessageobjectsID(soapModel.getMessageobjectsID());
		model.setObject_id(soapModel.getObject_id());

		return model;
	}

	/**
	 * Converts the soap model instances into normal model instances.
	 *
	 * @param soapModels the soap model instances to convert
	 * @return the normal model instances
	 */
	public static List<message_objects> toModels(
		message_objectsSoap[] soapModels) {
		if (soapModels == null) {
			return null;
		}

		List<message_objects> models = new ArrayList<message_objects>(soapModels.length);

		for (message_objectsSoap soapModel : soapModels) {
			models.add(toModel(soapModel));
		}

		return models;
	}

	public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
				"lock.expiration.time.de.hsmannheim.pepa.patientenportal.apanwep.model.message_objects"));

	public message_objectsModelImpl() {
	}

	@Override
	public long getPrimaryKey() {
		return _messageobjectsID;
	}

	@Override
	public void setPrimaryKey(long primaryKey) {
		setMessageobjectsID(primaryKey);
	}

	@Override
	public Serializable getPrimaryKeyObj() {
		return _messageobjectsID;
	}

	@Override
	public void setPrimaryKeyObj(Serializable primaryKeyObj) {
		setPrimaryKey(((Long)primaryKeyObj).longValue());
	}

	@Override
	public Class<?> getModelClass() {
		return message_objects.class;
	}

	@Override
	public String getModelClassName() {
		return message_objects.class.getName();
	}

	@Override
	public Map<String, Object> getModelAttributes() {
		Map<String, Object> attributes = new HashMap<String, Object>();

		attributes.put("messageobjectsID", getMessageobjectsID());
		attributes.put("object_id", getObject_id());

		return attributes;
	}

	@Override
	public void setModelAttributes(Map<String, Object> attributes) {
		Long messageobjectsID = (Long)attributes.get("messageobjectsID");

		if (messageobjectsID != null) {
			setMessageobjectsID(messageobjectsID);
		}

		Long object_id = (Long)attributes.get("object_id");

		if (object_id != null) {
			setObject_id(object_id);
		}
	}

	@JSON
	@Override
	public long getMessageobjectsID() {
		return _messageobjectsID;
	}

	@Override
	public void setMessageobjectsID(long messageobjectsID) {
		_messageobjectsID = messageobjectsID;
	}

	@JSON
	@Override
	public long getObject_id() {
		return _object_id;
	}

	@Override
	public void setObject_id(long object_id) {
		_object_id = object_id;
	}

	@Override
	public ExpandoBridge getExpandoBridge() {
		return ExpandoBridgeFactoryUtil.getExpandoBridge(0,
			message_objects.class.getName(), getPrimaryKey());
	}

	@Override
	public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
		ExpandoBridge expandoBridge = getExpandoBridge();

		expandoBridge.setAttributes(serviceContext);
	}

	@Override
	public message_objects toEscapedModel() {
		if (_escapedModel == null) {
			_escapedModel = (message_objects)ProxyUtil.newProxyInstance(_classLoader,
					_escapedModelInterfaces, new AutoEscapeBeanHandler(this));
		}

		return _escapedModel;
	}

	@Override
	public Object clone() {
		message_objectsImpl message_objectsImpl = new message_objectsImpl();

		message_objectsImpl.setMessageobjectsID(getMessageobjectsID());
		message_objectsImpl.setObject_id(getObject_id());

		message_objectsImpl.resetOriginalValues();

		return message_objectsImpl;
	}

	@Override
	public int compareTo(message_objects message_objects) {
		long primaryKey = message_objects.getPrimaryKey();

		if (getPrimaryKey() < primaryKey) {
			return -1;
		}
		else if (getPrimaryKey() > primaryKey) {
			return 1;
		}
		else {
			return 0;
		}
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}

		if (!(obj instanceof message_objects)) {
			return false;
		}

		message_objects message_objects = (message_objects)obj;

		long primaryKey = message_objects.getPrimaryKey();

		if (getPrimaryKey() == primaryKey) {
			return true;
		}
		else {
			return false;
		}
	}

	@Override
	public int hashCode() {
		return (int)getPrimaryKey();
	}

	@Override
	public void resetOriginalValues() {
	}

	@Override
	public CacheModel<message_objects> toCacheModel() {
		message_objectsCacheModel message_objectsCacheModel = new message_objectsCacheModel();

		message_objectsCacheModel.messageobjectsID = getMessageobjectsID();

		message_objectsCacheModel.object_id = getObject_id();

		return message_objectsCacheModel;
	}

	@Override
	public String toString() {
		StringBundler sb = new StringBundler(5);

		sb.append("{messageobjectsID=");
		sb.append(getMessageobjectsID());
		sb.append(", object_id=");
		sb.append(getObject_id());
		sb.append("}");

		return sb.toString();
	}

	@Override
	public String toXmlString() {
		StringBundler sb = new StringBundler(10);

		sb.append("<model><model-name>");
		sb.append(
			"de.hsmannheim.pepa.patientenportal.apanwep.model.message_objects");
		sb.append("</model-name>");

		sb.append(
			"<column><column-name>messageobjectsID</column-name><column-value><![CDATA[");
		sb.append(getMessageobjectsID());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>object_id</column-name><column-value><![CDATA[");
		sb.append(getObject_id());
		sb.append("]]></column-value></column>");

		sb.append("</model>");

		return sb.toString();
	}

	private static ClassLoader _classLoader = message_objects.class.getClassLoader();
	private static Class<?>[] _escapedModelInterfaces = new Class[] {
			message_objects.class
		};
	private long _messageobjectsID;
	private long _object_id;
	private message_objects _escapedModel;
}